home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / dbms_mag / 9101 / techtip3.jan < prev   
Text File  |  1990-11-16  |  1KB  |  54 lines

  1.  
  2. *************** PROGRAM LISTING 3A *****************
  3. * Sleep.PRG
  4. * A program stub for testing the pause() function written in C
  5.  
  6. * Author:     Jack Ho
  7. * Occupation: Network Planning Officer
  8. *             Canada Post Corporation
  9. * Member:     VCDA
  10. * Date:       September 1, 1990
  11.  
  12. * To be placed in public domain with no strings attached
  13. * Disclaimer - No warranty whatsoever. Use it at your own risk
  14.  
  15. * Clipper compiling command: CLIPPER SLEEP -m
  16.  
  17. CLEAR
  18. secs = 0
  19.    @ 10, 10 SAY "Number of seconds to sleep? " GET secs PICT "99"
  20.    READ
  21.    pause(secs)
  22. RETURN
  23.  
  24.  
  25. *************** PROGRAM LISTING 3B *****************
  26. /* pausekey.c  -  function to replace the Clipper INKEY(<expN>) */
  27. /*                but not the INKEY(0). A DBXL SLEEP simulation */
  28.  
  29. /* MS Quick C compiling command: qcl /c /Gs /AL /Zl pausekey.c  */
  30. /* Linking command: link /NOE sleep pausekey ,,, clipper.lib +  */
  31. /*                  extend.lib + llibce.lib                     */
  32.  
  33. #include <time.h>
  34. #include <stdio.h>
  35. #include "nandef.h"
  36. #include "extend.h"
  37.  
  38. extern long time ();
  39.  
  40. CLIPPER pause (seconds)
  41. int    seconds;
  42. {
  43.     int nothing = 0;
  44.     long kount;
  45.     time (&kount);
  46.     seconds = _parni (1);
  47.  
  48.     while ((time ((long *) NULL) - kount) < seconds)
  49.     {
  50.        /* executing the "do nothing" loop until time's up */
  51.     }
  52.     _retni (nothing);
  53. }
  54.